with Ada.Text_IO;

with GNAT.Regexp; use GNAT.Regexp;

use Ada;


with Headers_Parser.Content_Length;


--
-- test Headers Parser package
--

package Test_Headers_Parser
is

   --
   -- run all tests
   --

   procedure Tests_Suite;


private

   --
   -- Headers Parser package and other types, instances shared by tests
   --

   MAX_HTTP_DATA_LENGTH : constant := 50_000;

   package Headers_Parser_Pkg is new Headers_Parser( MAX_HTTP_DATA_LENGTH );

   --
   -- instantiate content length header parser child package for parsing
   --    content-length value
   --

   package Content_Length_Headers_Pkg is new Headers_Parser_Pkg.Content_Length;


   TEST_WEB_DATA_FILE : constant String := "test_parse_headers.txt";


   Test_File_In : Text_IO.File_Type;

   Test_File_Empty : exception;


   Test_Header_RegEx : constant Regexp := GNAT.Regexp.Compile(

         Pattern => ".*Content[\-]?Type:[ ]?text[\/]?html.*",

         Case_Sensitive => true );


   Test_Html_RegEx : constant Regexp := GNAT.Regexp.Compile(

         Pattern => ".*[\<]?body[\>]?.+[\<]?[\/]?body[\>]?.*",

         Case_Sensitive => false );


   --
   -- test retrieval of headers
   --

   procedure Test_Parse_Headers;


   --
   -- test parse of numeric content-length header value
   --
   --       see Headers_Parser_Pkg
   --

   procedure Test_Parse_Headers_Get_Content_Length;


   --
   -- test retrieval of content
   --

   procedure Test_Parse_Content;


   --
   -- read file containing sample http headers and content for tests
   --

   function Read_Test_Data_File return String;


end Test_Headers_Parser;